package com.niiwoo.civet.trade.dto.response.myloan;

import com.niiwoo.civet.trade.enums.ProjectStatusEnum;
import com.niiwoo.civet.trade.enums.ProjectSubStatusEnum;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Getter
@Setter
public class LoanEndResponseDTO implements Serializable {

    private static final long serialVersionUID = 4507971101694334585L;

    private Long projectId;

    private String projectTitle;

    private Date publishTime;

    private Integer deadline;

    private Byte deadlineUnit;

    private BigDecimal borrowRate;

    private BigDecimal contractAmount;

    private Byte status;

    private Integer subStatus;

    private String msg;

    private String channelCode;

    /**
     * 合同查看地址
     */
    private String viewUrl;

    /**
     * H5Url
     */
    private String h5Url;

    /**
     * 极速借或者信用借,1:极速借, 2:信用借
     */
    private Byte borrowType = 1;

    /**
     * 业务类型
     */
    private Byte type;

    /*public Byte getChannelCode() {
        return ChannelCodeEnum.enumOf(channelCode).getFinanceFlag();
    }*/


    public String getMsg() {
        if (status.byteValue() == ProjectStatusEnum.FINISH.getStatus().byteValue()) {
            return ProjectSubStatusEnum.enumOf(subStatus).getMsg();
        }
        return "";
    }
}